<!DOCTYPE html>
<html>
<head>
<title>提现管理</title>
#include("../include/common.html")
</head>
<body class="gray-bg">
    <div class="wrapper wrapper-content">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>提现管理</h5>
            </div>
            <form id="listForm" action="list" method="get">
            	<input type="hidden" name="status" id="status" value="#(status)">
                <div class="ibox-content">
                    <!-- 列表 start -->
                    <div class="form-horizontal clear">
                        <div class="form-group">
                            <div class="col-sm-8">
                                <a href="javascript:;" class="btn btn-primary" id="refreshButton"><i class="fa fa-refresh"></i> 刷新</a>
                            </div>
                        </div>
                        <div class="tabs-container">
		                   <ul class="nav nav-tabs">
		                        <li #if(status=="PENDING_CHECK")class="active"#end><a data-toggle="tab" href="javascript:void(0)" onclick="statusSearch('PENDING_CHECK')">待受理</a></li>
		                        <li #if(status=="REJECTED")class="active"#end><a data-toggle="tab" href="javascript:void(0)" onclick="statusSearch('REJECTED')">已驳回</a></li>
		                        <li #if(status=="PENDING_PAYMENT")class="active"#end><a data-toggle="tab" href="javascript:void(0)" onclick="statusSearch('PENDING_PAYMENT')">待打款</a></li>
		                        <li #if(status=="COMPLETED")class="active"#end><a data-toggle="tab" href="javascript:void(0)" onclick="statusSearch('COMPLETED')">已打款</a></li>
		                    </ul>
		                    <!-- tab -->
		                    <div class="tab-content">
		                        <div class="tab-pane active">
		                            <div class="panel-body form-horizontal">
				                        <div class="table-responsive">
				                            <table class="table table-bordered" id="listTable">
				                                <thead>
				                                    <tr>
				                                        <th width="40" class="text-center"><input type="checkbox" id="selectAll" /></th>
				                                        <th>ID</th>
				                                        <th>会员</th>
				                                        <th>金额</th>
				                                        <th>账户类型</th>
				                                        <th>银行名称</th>
				                                        <th>账户</th>
				                                        <th>姓名</th>
				                                        <th>状态</th>
				                                        <th>创建日期</th>
				                                        <th>操作</th>
				                                    </tr>
				                                </thead>
				                                <tbody>
				                                    #for(withdraw : page.list)
				                                    <tr>
				                                        <td class="text-center"><input type="checkbox" name="ids" value="#(withdraw.id)" /></td>
				                                        <td>#(withdraw.id)</td>
				                                         <td>
				                                        	ID:#(withdraw.member.id)<br>
				                                        	昵称:#(withdraw.member.nickname??"")<br>
				                                        	手机号码:#(withdraw.member.mobile??"")<br>
				                                        </td>
				                                        <td>#(withdraw.amount)</td>
				                                        <td>#if(withdraw.member.accountType=="Wechat")微信#else if(withdraw.member.accountType=="Alipay")支付宝#else if(withdraw.member.accountType=="Bank")银行#end</td>
				                                        <td>#(withdraw.member.bankName)</td>
				                                        <td>#(withdraw.member.account)</td>
				                                        <td>#(withdraw.member.accountName)</td>
				                                        <td>#(withdraw.statusName)</td>
				                                        <td>#(withdraw.createDate)</td>
				                                        <td>
				                                            #if(withdraw.status=="PENDING_CHECK")
					                                            <a class="check" href="javascript:;" status="PENDING_PAYMENT" withdrawId="#(withdraw.id)">[受理]</a>
					                                            <a class="check" href="javascript:;" status="REJECTED" withdrawId="#(withdraw.id)">[驳回]</a>
				                                            #else if(withdraw.status=="PENDING_PAYMENT")
				                                                <a class="check" href="javascript:;" status="COMPLETED" withdrawId="#(withdraw.id)">[打款]</a>
				                                            #end
				                                        </td>
				                                    </tr>
				                                    #end
				                                </tbody>
				                            </table>
			                            </div>
		                            </div>
	                            </div>
                            </div>
                        </div>
                        <div class="text-center">
                            #pagination(pageNumber = page.pageNumber,totalPages = page.totalPage,pattern = "")
                                 #include("../include/pagination.html")
                            #end
                        </div>
                    </div>
                    <!-- 列表 end -->
                </div>
            </form>
        </div>
    </div>
</body>
</html>
<script type="text/javascript">
function statusSearch(status){
	$("#status").val(status);
	$("#listForm").submit();
}
$(".check").click( function() {
	var status = $(this).attr("status");
	var withdrawId = $(this).attr("withdrawId");
	if(confirm("您确定要操作吗？")){
		$.ajax({
			url: "updateStatus",
			type: "POST",
			data: {"withdrawId":withdrawId,"status":status},
			dataType: "json",
			cache: false,
			success: function(message) {
				if (message.type == "success") {
					location.reload();
				}
			}
		});
	}
	return false;
});
</script>